package com.own.business.exam.entity.vo;


import com.own.business.exam.entity.po.ExamRuleQuestionCount;
import com.own.component.common.base.entity.vo.BaseCreateVo;
import com.own.constant.ConstantBeanSuffix;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

/**
 * ExamRuleQuestionCountVo
 *
 * @author 陈学礼 （你是一段成熟的代码，要学会自己改bug）
 * @version 4.0.0
 * @date 2021/05/19 14:01:47
 * @since 4.0.0
 */
@ApiModel("考试规则题目类型数量表" + ConstantBeanSuffix.VO)
@Getter
@Setter
@ToString
@Accessors(chain = true)
@AllArgsConstructor
@NoArgsConstructor
public class ExamRuleQuestionCountVo extends BaseCreateVo<ExamRuleQuestionCount> {

    @ApiModelProperty("规则id")
    private Long ruleId;

    @ApiModelProperty("题目类型")
    private Integer type;

    @ApiModelProperty("数量")
    private Integer number;

    /**
     * 构造方法
     *
     * @param entity 原对象
     */
    public ExamRuleQuestionCountVo(@NonNull ExamRuleQuestionCount entity) {
        super(entity);
        this.ruleId = entity.getFkRuleId();
        this.type = entity.getType();
        this.number = entity.getNumber();
    }

    /**
     * 转po对象
     *
     * @param entity 原
     * @return po对象
     */
    @Override
    public ExamRuleQuestionCount toPo(ExamRuleQuestionCount entity) {
        if (entity == null) {
            entity = new ExamRuleQuestionCount();
        }
        entity.setFkRuleId(this.ruleId);
        entity.setType(this.type);
        entity.setNumber(this.number);
        return super.toPo(entity);
    }

}
